package com.cheer.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cheer.dto.AdminPageDTO;
import com.cheer.entity.Admin;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface AdminDao extends BaseMapper<Admin> {

    default Admin getByAccountId(Long accountId) {
        return selectOne(new QueryWrapper<Admin>()
                .eq("account_id", accountId)
                .last("limit 1"));
    }

    List<AdminPageDTO> listPage(@Param("orgPath") String orgPath, @Param("orgName") String orgName,
                                @Param("contactPerson") String contactPerson);
}
